
document.addEventListener("DOMContentLoaded", function () {
    // 示例：为搜索按钮添加点击事件
    document.querySelector(".search-form input[type='submit']").addEventListener("click", function (e) {
        const searchTerm = document.querySelector("#searchUserName").value;
        if (searchTerm.trim() === "") {
            alert("请输入搜索关键字！");
            e.preventDefault();
        }
    });

    // 示例：为返回按钮添加点击事件
    document.querySelector(".return-button").addEventListener("click", function () {
        if (confirm("确定要返回上一页吗？")) {
            history.back();
        }
    });

    // 示例：为表格行添加鼠标悬停效果
    const tableRows = document.querySelectorAll(".member-table tbody tr");
    tableRows.forEach(row => {
        row.addEventListener("mouseover", function () {
            this.style.backgroundColor = "#d1e7dd"; // 悬停时背景颜色变化
        });
        row.addEventListener("mouseout", function () {
            this.style.backgroundColor = ""; // 移除悬停效果
        });
    });
});